package cn.gailvlun.gll.net.emotion;

import android.databinding.ObservableInt;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

import java.util.Date;
import java.util.List;

import cn.gailvlun.gll.net.base.Profile;
import io.realm.RealmList;
import io.realm.RealmObject;
import io.realm.annotations.Ignore;
import io.realm.annotations.PrimaryKey;



public class Emotion extends RealmObject {
    @PrimaryKey
    private int id;
    private String text;
    private Profile owner;
    @Ignore
    private Heart heart;
    private Date created;
    private String emotion;
    private int comment_num;
    private RealmList<String> pics;
    @Ignore
    private int read_num;
    @Ignore
    @Expose(serialize = false, deserialize = false)
    private ObservableInt readObservable;
    @Ignore
    @SerializedName("topic_set")
    private List<EmotionTag> emotionTagList;
    private String anony;

    public ObservableInt getReadObservable() {
        if (readObservable == null) {
            readObservable = new ObservableInt(read_num);
        }
        return readObservable;
    }

    public Emotion setReadObservable(ObservableInt readObservable) {
        this.readObservable = readObservable;
        return this;
    }

    public int getRead_num() {
        return read_num;
    }

    public void setRead_num(int read_num) {
        this.read_num = read_num;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public Profile getOwner() {
        return owner;
    }

    public void setOwner(Profile owner) {
        this.owner = owner;
    }

    public Heart getHeart() {
        return heart;
    }

    public void setHeart(Heart heart) {
        this.heart = heart;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public EmotionEnum getEmotion() {
        for (EmotionEnum state : EmotionEnum.values()) {
            if (state.name().equals(emotion)) {
                return EmotionEnum.valueOf(emotion);
            }

        }

        return null;
    }

    public void setEmotion(EmotionEnum emotion) {
        this.emotion = emotion.name();
    }

    public int getComment_num() {
        return comment_num;
    }

    public void setComment_num(int comment_num) {
        this.comment_num = comment_num;
    }

    public RealmList<String> getPics() {
        return pics;
    }

    public void setPics(RealmList<String> pics) {
        this.pics = pics;
    }

    public List<EmotionTag> getEmotionTagList() {
        return emotionTagList;
    }

    public Emotion setmotionTagList(List<EmotionTag> emotionTagList) {
        this.emotionTagList = emotionTagList;
        return this;
    }
    public String getAnony() {
        return anony;
    }

    public void setAnony(String anony) {
        this.anony = anony;
    }
}
